﻿// -----------------------------------------------------------------------
// <copyright file="wheel.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Ex03.GarageLogic
{
    using System;
    using System.Collections.Generic;
    using System.Text;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Wheel
    {
        private string m_Manufacture;
        private float m_CurrentAirPresure;
        private float m_MaxAirPresure;

        public Wheel()
        {
        }

        public Wheel(float i_MaxAirPressure, float i_CurrentAirPressure, string i_Manufacture)
        {
            m_Manufacture = i_Manufacture;
            m_CurrentAirPresure = i_CurrentAirPressure;
            m_MaxAirPresure = i_MaxAirPressure;
        }
        
        public void SetMaxAirPressure(float i_MaxPressure)
        {
            m_MaxAirPresure = i_MaxPressure;
        }

        public void SetManufactor(string i_Manufactor)
        {
            m_Manufacture = i_Manufactor;
        }

        public void SetCurrentAirPressure(float i_CurrentAirPressure)
        {
            m_CurrentAirPresure = i_CurrentAirPressure;
        }

        public void InflateWheel(float i_pressureToAdd)
        {
            if (i_pressureToAdd + m_CurrentAirPresure <= m_MaxAirPresure)
            {
                m_CurrentAirPresure += i_pressureToAdd;
            }
            else
            {
                throw new ValueOutOfRangeException(0, m_MaxAirPresure - m_CurrentAirPresure);
            }
        }

        public float CurrentAirPressure
        {
            get
            {
                return m_CurrentAirPresure;
            }

            set
            {
                m_CurrentAirPresure = value;
            }
        }

        public float MaxAirPressure
        {
            get
            {
                return m_MaxAirPresure;
            }

            set
            {
                m_MaxAirPresure = value;
            }
        }

        public StringBuilder GetWheelDataPrint()
        {
            StringBuilder wheelData = new StringBuilder();

            wheelData.Append("The wheel is made by: " + m_Manufacture + System.Environment.NewLine);
            wheelData.Append("The wheel's maximum air pressure is: " + m_MaxAirPresure + " Cc's" + System.Environment.NewLine);
            wheelData.Append("The wheel's current air pressure is: " + m_CurrentAirPresure + " Cc's"  + System.Environment.NewLine);

            return wheelData;
        }
    }
}
